import { SkillInfoPanel } from "../SkillInfoPanel";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { ModuleBg } from "../../common/ModuleBg";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { SkillDetailPanel } from "../career/SkillDetailPanel";
import { SkillInfo } from "../../../model/SkillInfo";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { SkillItem } from "../SkillItem";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
//class SkillMarryInfoPanel
    
    export  class SkillMarryInfoPanel extends SkillInfoPanel
    {
        constructor()
        {
            super();
            this._skillName = new GLabel();
            this._skillLevel = new GLabel();
            this._bg = new ModuleBg();
            this.createMainInfo();
            addChild(this._bg);
            return;
        }

        /* internal  */createMainInfo(): void
        {
            this._bg.addItem(ResouceConst.getScaleBitmap(ImagesConst.DisabledBg), {"x": 4, "y": 4, "width": width - 8, "height": 50});
            this._bg.addItem(GlobalClass.getBitmap(ImagesConst.PackItemBg), {"x": 15, "y": 10});
            this._bg.addItem(this._skillName, {"x": 60, "y": 12, "width": 150, "height": 18, "styleName":"GLabel"});
            this._bg.addItem(this._skillLevel, {"x": 60, "y": 28, "width": 150, "height": 18, "styleName":"GLabel"});
            return;
        }

        /* internal  */createDetailInfo(): void
        {
            if (!this._detailPanel) 
            {
                this._detailPanel = new SkillDetailPanel();
            }
            if (!this._detailPanel.parent) 
            {
                this._bg.addItem(this._detailPanel, {"x": 4, "y": 62});
            }
            return;
        }

        public /* override */ updateInfo(arg1: SkillInfo): void
        {
            _skillMapData = arg1;
            _skill = _skillMapData.tSkill;
            this.createDetailInfo();
            this._detailPanel.updateData(_skillMapData);
            var loc1=_skillMapData.levelMax ? HTMLUtil.addColor(Language.getString(20682), "#00ff00") : HTMLUtil.addColor(Language.getString(20683), "#ff0000");
            this._skillName.text = _skillMapData.tSkill.skillName;
            if (_skillMapData.learned) 
            {
                this._skillLevel.htmlText = Language.getString(20684) + _skillMapData.tSkill.skillLevel + loc1;
            }
            else 
            {
                this._skillLevel.htmlText = Language.getString(20684) + "0" + loc1;
            }
            if (!this._skillItem) 
            {
                this._skillItem = new SkillItem();
                this._bg.addItem(this._skillItem, {"x": 18, "y": 13});
            }
            this._skillItem.data = _skillMapData;
            this._skillItem.toolTipDataFunction = this.getToolTipData;
            return;
        }

        /* internal  */getToolTipData(arg1: SkillItem): ToolTipInfo
        {
            return (arg1.data as SkillInfo).getToolTipInfo();
        }

        /* internal */ /* var */_skillItem: SkillItem;

        /* internal */ /* var */_bg: ModuleBg;

        /* internal */ /* var */_skillName: GLabel;

        /* internal */ /* var */_skillLevel: GLabel;

        /* internal */ /* var */_detailPanel: SkillDetailPanel;
    }
